# coding=utf-8
# 一个屋子里需要有多少人，才能使得存在至少两个人生日是同一天的概率达到 50%？
# 从一个人开始直到365人, 计算每个人都是不通生日的概率
# 最后1-p计算两个人相同的概率


for nums in range(365):
    sum = 1
    for i in range(1, nums):
        sum = sum * ((365-i)/365)

    p_50 = 1-sum
    print("nums:", nums, "values:", p_50)
    if p_50 >= 0.5:
        print(nums)
        break

"""
nums: 0 values: 0
nums: 1 values: 0
nums: 2 values: 0.002739726027397249
nums: 3 values: 0.008204165884781345
nums: 4 values: 0.016355912466550215
nums: 5 values: 0.02713557369979347
nums: 6 values: 0.040462483649111425
nums: 7 values: 0.056235703095975365
nums: 8 values: 0.07433529235166902
nums: 9 values: 0.09462383388916673
nums: 10 values: 0.11694817771107768
nums: 11 values: 0.14114137832173312
nums: 12 values: 0.1670247888380645
nums: 13 values: 0.19441027523242949
nums: 14 values: 0.2231025120049731
nums: 15 values: 0.25290131976368646
nums: 16 values: 0.2836040052528501
nums: 17 values: 0.3150076652965609
nums: 18 values: 0.3469114178717896
nums: 19 values: 0.37911852603153695
nums: 20 values: 0.41143838358058027
nums: 21 values: 0.443688335165206
nums: 22 values: 0.4756953076625503
nums: 23 values: 0.5072972343239857
23
"""